//
// Created by ashCheng on 2023/2/1.
// 1.5.2
#include <iostream>
#include <string>

struct Sales_data {
  std::string bookNo;
  unsigned units_sold = 0;
  double revenue = 0.0;
};

int main() {
  Sales_data data1, data2;
  double price1, price2;
  std::cin >> data1.bookNo >> data1.units_sold >> price1;
  std::cin >> data2.bookNo >> data2.units_sold >> price2;
  data1.revenue = data1.units_sold * price1;
  data2.revenue = data2.units_sold * price2;

  if (data1.bookNo == data2.bookNo) {
    unsigned total_cnt = data1.units_sold + data2.units_sold;
    double total_revenue = data1.revenue + data2.revenue;
    std::cout << data1.bookNo << " " << total_cnt << " " << total_revenue << " ";
    if (total_cnt != 0) {
      std::cout << total_revenue / total_cnt << std::endl;
    } else {
      std::cout << "No sales!" << std::endl;
    }
    return 0;
  } else {
    std::cerr << "Data must refer to same ISBN" << std::endl;
    return -1;  // indicate failure
  }
}